The <pre> tag
The HTML <pre> tag is used for pre-formatted text. It keeps the original spaces and line breaks exactly as they are in the code. When you use <pre>, the text appears in a fixed-width font, preserving the formatting and layout just as it looks in the HTML code.
Syntax:
<pre> Content </pre>
Example: This example explains the use of the <pre> tag in the <p> tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>HTML paragraph
</title>
</head>
<body>
<pre>
This paragraph has multiple
lines. But it is displayed
as it is unlike the paragraph
tag.
</pre>
<pre>
This paragraph has multiple
spaces. But it is displayed
as it is unlike the paragraph
tag.
</pre>
</body>
</html>
Output:
HTML Paragraphs
The <p> tag in HTML signifies a paragraph. Enclosed within the opening <p> and closing </p> tags, any content is recognized as a paragraph. As a block-level element, a new paragraph inherently starts on a fresh line, with browsers intuitively adding space before and after a paragraph for enhanced readability.
Syntax:
<p> Content </p>
Contact Us